package com.jchy.renderit.displayable;
 
import com.jchy.renderit.core.Hit;
import com.jchy.renderit.core.Point;

public class BilliardStripe extends Sphere
{

    private java.awt.Color secondaryColor;
    public  double stripeWidth;

    public BilliardStripe()
    {
        secondaryColor=new java.awt.Color(255,0,0);
        stripeWidth=0.70;
    }    

    public void setSecondaryColorInt(int red, int green, int blue)
    {
        secondaryColor=new java.awt.Color(red, green, blue);
    }

    public int getSecondaryColorRed()
    {
        return secondaryColor.getRed();
    }

    public int getSecondaryColorGreen()
    {
        return secondaryColor.getGreen();
    }

    public int getSecondaryColorBlue()
    {
        return secondaryColor.getBlue();
    }

    public Hit intersect(Point prp, Point vrp)
    {
        Hit   aHit = new Hit();        
        Point utloc;

        aHit=super.intersect(prp,vrp);

        if(aHit.isHit)
        {
            utloc=untransform(aHit.location);
            if(Math.abs(utloc.x)<(stripeWidth/2.0)) 
                aHit.color=new java.awt.Color(getSecondaryColorRed(),
                                              getSecondaryColorGreen(),
                                              getSecondaryColorBlue());
        }

        return aHit;        
    }

}

